🎖️GitЯра🎖️
src/helpers/ui/OLEDDisplay.h 890a2e2cffa98dea3ca88db3c3aba72ef23ff3f7 (890a2e2c) Text, 12.11 KB
T8b949e/**
* The MIT License (MIT)
*
* Copyright (c) 2018 by ThingPulse, Daniel Eichhorn
* Copyright (c) 2018 by Fabrice Weinberg
* Copyright (c) 2019 by Helmut Tschemernjak - www.radioshuttle.de
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* ThingPulse invests considerable time and money to develop these open source libraries.
* Please support us by buying our products (and not the clones) from
* https://thingpulse.com
*
*/
Tff7b72#Tff7b72ifndef OLEDDISPLAY_h
Tff7b72#Tff7b72define OLEDDISPLAY_h
Tff7b72#Tff7b72include T8b949e<cstdarg>
Tff7b72#Tff7b72ifdef ARDUINO
Tff7b72#Tff7b72include T8b949e<Arduino.h>
Tff7b72#Tff7b72elif __MBED__
Tff7b72#Tff7b72define pgm_read_byte(addr) (*(const unsigned char *)(addr))
Tff7b72#Tff7b72include T8b949e<mbed.h>
Tff7b72#Tff7b72define delay(x) wait_ms(x)
Tff7b72#Tff7b72define yield() void()
T8b949e/*
* This is a little Arduino String emulation to keep the OLEDDisplay
* library code in common between Arduino and mbed-os
*/
Te6edf3class Te6edf3String Tb4b4b4{
Te6edf3publicTff7b72:
Te6edf3StringTb4b4b4(Tff7b72const Tffa657char Tff7b72*Te6edf3sTb4b4b4) Tb4b4b4{ Te6edf3_str Tff7b72= Te6edf3sTb4b4b4; Tb4b4b4}Tb4b4b4;
Tffa657int Td2a8fflengthTb4b4b4(Tb4b4b4) Tb4b4b4{ Tff7b72return Te6edf3strlenTb4b4b4(Te6edf3_strTb4b4b4)Tb4b4b4; Tb4b4b4}Tb4b4b4;
Tff7b72const Tffa657char Tff7b72*Td2a8ffc_strTb4b4b4(Tb4b4b4) Tb4b4b4{ Tff7b72return Te6edf3_strTb4b4b4; Tb4b4b4}Tb4b4b4;
Tffa657void Td2a8fftoCharArrayTb4b4b4(Tffa657char Tff7b72*Te6edf3bufTb4b4b4, Tffa657unsigned Tffa657int Te6edf3bufsizeTb4b4b4, Tffa657unsigned Tffa657int Te6edf3index Tff7b72= T79c0ff0Tb4b4b4) Tff7b72const Tb4b4b4{
Te6edf3memcpyTb4b4b4(Te6edf3bufTb4b4b4, Te6edf3_str Tff7b72+ Te6edf3indexTb4b4b4, Te6edf3stdTff7b72:Tff7b72:Te6edf3minTb4b4b4(Te6edf3bufsizeTb4b4b4, Te6edf3strlenTb4b4b4(Te6edf3_strTb4b4b4)Tb4b4b4)Tb4b4b4)Tb4b4b4;
Tb4b4b4}Tb4b4b4;
Te6edf3privateTff7b72:
Tff7b72const Tffa657char Tff7b72*Te6edf3_strTb4b4b4;
Tb4b4b4}Tb4b4b4;
Tff7b72#Tff7b72else
Tff7b72#Tff7b72error "Unknown operating system"
Tff7b72#Tff7b72endif
Tff7b72#Tff7b72include T8b949e"OLEDDisplayFonts.h"
T8b949e//#define DEBUG_OLEDDISPLAY(...) Serial.printf( __VA_ARGS__ )
T8b949e//#define DEBUG_OLEDDISPLAY(...) dprintf("%s", __VA_ARGS__ )
Tff7b72#Tff7b72ifndef DEBUG_OLEDDISPLAY
Tff7b72#Tff7b72define DEBUG_OLEDDISPLAY(...)
Tff7b72#Tff7b72endif
T8b949e// Use DOUBLE BUFFERING by default
Tff7b72#Tff7b72ifndef OLEDDISPLAY_REDUCE_MEMORY
Tff7b72#Tff7b72define OLEDDISPLAY_DOUBLE_BUFFER
Tff7b72#Tff7b72endif
T8b949e// Header Values
Tff7b72#Tff7b72define JUMPTABLE_BYTES 4
Tff7b72#Tff7b72define JUMPTABLE_LSB 1
Tff7b72#Tff7b72define JUMPTABLE_SIZE 2
Tff7b72#Tff7b72define JUMPTABLE_WIDTH 3
Tff7b72#Tff7b72define JUMPTABLE_START 4
Tff7b72#Tff7b72define WIDTH_POS 0
Tff7b72#Tff7b72define HEIGHT_POS 1
Tff7b72#Tff7b72define FIRST_CHAR_POS 2
Tff7b72#Tff7b72define CHAR_NUM_POS 3
T8b949e// Display commands
Tff7b72#Tff7b72define CHARGEPUMP 0x8D
Tff7b72#Tff7b72define COLUMNADDR 0x21
Tff7b72#Tff7b72define COMSCANDEC 0xC8
Tff7b72#Tff7b72define COMSCANINC 0xC0
Tff7b72#Tff7b72define DISPLAYALLON 0xA5
Tff7b72#Tff7b72define DISPLAYALLON_RESUME 0xA4
Tff7b72#Tff7b72define DISPLAYOFF 0xAE
Tff7b72#Tff7b72define DISPLAYON 0xAF
Tff7b72#Tff7b72define EXTERNALVCC 0x1
Tff7b72#Tff7b72define INVERTDISPLAY 0xA7
Tff7b72#Tff7b72define MEMORYMODE 0x20
Tff7b72#Tff7b72define NORMALDISPLAY 0xA6
Tff7b72#Tff7b72define PAGEADDR 0x22
Tff7b72#Tff7b72define SEGREMAP 0xA0
Tff7b72#Tff7b72define SETCOMPINS 0xDA
Tff7b72#Tff7b72define SETCONTRAST 0x81
Tff7b72#Tff7b72define SETDISPLAYCLOCKDIV 0xD5
Tff7b72#Tff7b72define SETDISPLAYOFFSET 0xD3
Tff7b72#Tff7b72define SETHIGHCOLUMN 0x10
Tff7b72#Tff7b72define SETLOWCOLUMN 0x00
Tff7b72#Tff7b72define SETMULTIPLEX 0xA8
Tff7b72#Tff7b72define SETPRECHARGE 0xD9
Tff7b72#Tff7b72define SETSEGMENTREMAP 0xA1
Tff7b72#Tff7b72define SETSTARTLINE 0x40
Tff7b72#Tff7b72define SETVCOMDETECT 0xDB
Tff7b72#Tff7b72define SWITCHCAPVCC 0x2
Tff7b72#Tff7b72ifndef _swap_int16_t
Tff7b72#Tff7b72define _swap_int16_t(a, b) { int16_t t = a; a = b; b = t; }
Tff7b72#Tff7b72endif
Tff7b72enum Te6edf3OLEDDISPLAY_COLOR Tb4b4b4{
Te6edf3BLACK Tff7b72= T79c0ff0Tb4b4b4,
Te6edf3WHITE Tff7b72= T79c0ff1Tb4b4b4,
Te6edf3INVERSE Tff7b72= T79c0ff2
Tb4b4b4}Tb4b4b4;
Tff7b72enum Te6edf3OLEDDISPLAY_TEXT_ALIGNMENT Tb4b4b4{
Te6edf3TEXT_ALIGN_LEFT Tff7b72= T79c0ff0Tb4b4b4,
Te6edf3TEXT_ALIGN_RIGHT Tff7b72= T79c0ff1Tb4b4b4,
Te6edf3TEXT_ALIGN_CENTER Tff7b72= T79c0ff2Tb4b4b4,
Te6edf3TEXT_ALIGN_CENTER_BOTH Tff7b72= T79c0ff3
Tb4b4b4}Tb4b4b4;
Tff7b72enum Te6edf3OLEDDISPLAY_GEOMETRY Tb4b4b4{
Te6edf3GEOMETRY_128_64 Tff7b72= T79c0ff0Tb4b4b4,
Te6edf3GEOMETRY_128_32 Tff7b72= T79c0ff1Tb4b4b4,
Te6edf3GEOMETRY_64_48 Tff7b72= T79c0ff2Tb4b4b4,
Te6edf3GEOMETRY_64_32 Tff7b72= T79c0ff3Tb4b4b4,
Te6edf3GEOMETRY_RAWMODE Tff7b72= T79c0ff4Tb4b4b4,
Te6edf3GEOMETRY_128_128 Tff7b72= T79c0ff5
Tb4b4b4}Tb4b4b4;
Tff7b72enum Te6edf3HW_I2C Tb4b4b4{
Te6edf3I2C_ONETb4b4b4,
Te6edf3I2C_TWO
Tb4b4b4}Tb4b4b4;
Tff7b72typedef Tffa657char Tb4b4b4(Tff7b72*Te6edf3FontTableLookupFunctionTb4b4b4)Tb4b4b4(Tff7b72const Tffa657uint8_t Te6edf3chTb4b4b4)Tb4b4b4;
Tffa657char Td2a8ffDefaultFontTableLookupTb4b4b4(Tff7b72const Tffa657uint8_t Te6edf3chTb4b4b4)Tb4b4b4;
Tff7b72#Tff7b72ifdef ARDUINO
Te6edf3class Te6edf3OLEDDisplay Tff7b72: Te6edf3public Te6edf3Print Tb4b4b4{
Tff7b72#Tff7b72elif __MBED__
Te6edf3class Te6edf3OLEDDisplay Tff7b72: Te6edf3public Te6edf3Stream Tb4b4b4{
Tff7b72#Tff7b72else
Tff7b72#Tff7b72error "Unknown operating system"
Tff7b72#Tff7b72endif
Te6edf3publicTff7b72:
Te6edf3OLEDDisplayTb4b4b4(Tb4b4b4)Tb4b4b4;
Te6edf3virtual Tff7b72~Te6edf3OLEDDisplayTb4b4b4(Tb4b4b4)Tb4b4b4;
Tffa657uint16_t Td2a8ffwidthTb4b4b4(Tffa657voidTb4b4b4) Tff7b72const Tb4b4b4{ Tff7b72return Te6edf3displayWidthTb4b4b4; Tb4b4b4}Tb4b4b4;
Tffa657uint16_t Td2a8ffheightTb4b4b4(Tffa657voidTb4b4b4) Tff7b72const Tb4b4b4{ Tff7b72return Te6edf3displayHeightTb4b4b4; Tb4b4b4}Tb4b4b4;
T8b949e// Use this to resume after a deep sleep without resetting the display (what init() would do).
T8b949e// Returns true if connection to the display was established and the buffer allocated, false otherwise.
Tffa657bool Td2a8ffallocateBufferTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// Allocates the buffer and initializes the driver & display. Resets the display!
T8b949e// Returns false if buffer allocation failed, true otherwise.
Tffa657bool Td2a8ffinitTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// Free the memory used by the display
Tffa657void Td2a8ffendTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// Cycle through the initialization
Tffa657void Td2a8ffresetDisplayTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
T8b949e/* Drawing functions */
T8b949e// Sets the color of all pixel operations
Tffa657void Td2a8ffsetColorTb4b4b4(Te6edf3OLEDDISPLAY_COLOR Te6edf3colorTb4b4b4)Tb4b4b4;
T8b949e// Returns the current color.
Te6edf3OLEDDISPLAY_COLOR Td2a8ffgetColorTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// Draw a pixel at given position
Tffa657void Td2a8ffsetPixelTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4)Tb4b4b4;
T8b949e// Draw a pixel at given position and color
Tffa657void Td2a8ffsetPixelColorTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Te6edf3OLEDDISPLAY_COLOR Te6edf3colorTb4b4b4)Tb4b4b4;
T8b949e// Clear a pixel at given position FIXME: INVERSE is untested with this function
Tffa657void Td2a8ffclearPixelTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4)Tb4b4b4;
T8b949e// Draw a line from position 0 to position 1
Tffa657void Td2a8ffdrawLineTb4b4b4(Tffa657int16_t Te6edf3x0Tb4b4b4, Tffa657int16_t Te6edf3y0Tb4b4b4, Tffa657int16_t Te6edf3x1Tb4b4b4, Tffa657int16_t Te6edf3y1Tb4b4b4)Tb4b4b4;
T8b949e// Draw the border of a rectangle at the given location
Tffa657void Td2a8ffdrawRectTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3widthTb4b4b4, Tffa657int16_t Te6edf3heightTb4b4b4)Tb4b4b4;
T8b949e// Fill the rectangle
Tffa657void Td2a8fffillRectTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3widthTb4b4b4, Tffa657int16_t Te6edf3heightTb4b4b4)Tb4b4b4;
T8b949e// Draw the border of a circle
Tffa657void Td2a8ffdrawCircleTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3radiusTb4b4b4)Tb4b4b4;
T8b949e// Draw all Quadrants specified in the quads bit mask
Tffa657void Td2a8ffdrawCircleQuadsTb4b4b4(Tffa657int16_t Te6edf3x0Tb4b4b4, Tffa657int16_t Te6edf3y0Tb4b4b4, Tffa657int16_t Te6edf3radiusTb4b4b4, Tffa657uint8_t Te6edf3quadsTb4b4b4)Tb4b4b4;
T8b949e// Fill circle
Tffa657void Td2a8fffillCircleTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3radiusTb4b4b4)Tb4b4b4;
T8b949e// Draw an empty triangle i.e. only the outline
Tffa657void Td2a8ffdrawTriangleTb4b4b4(Tffa657int16_t Te6edf3x0Tb4b4b4, Tffa657int16_t Te6edf3y0Tb4b4b4, Tffa657int16_t Te6edf3x1Tb4b4b4, Tffa657int16_t Te6edf3y1Tb4b4b4, Tffa657int16_t Te6edf3x2Tb4b4b4, Tffa657int16_t Te6edf3y2Tb4b4b4)Tb4b4b4;
T8b949e// Draw a solid triangle i.e. filled
Tffa657void Td2a8fffillTriangleTb4b4b4(Tffa657int16_t Te6edf3x0Tb4b4b4, Tffa657int16_t Te6edf3y0Tb4b4b4, Tffa657int16_t Te6edf3x1Tb4b4b4, Tffa657int16_t Te6edf3y1Tb4b4b4, Tffa657int16_t Te6edf3x2Tb4b4b4, Tffa657int16_t Te6edf3y2Tb4b4b4)Tb4b4b4;
T8b949e// Draw a line horizontally
Tffa657void Td2a8ffdrawHorizontalLineTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3lengthTb4b4b4)Tb4b4b4;
T8b949e// Draw a line vertically
Tffa657void Td2a8ffdrawVerticalLineTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3lengthTb4b4b4)Tb4b4b4;
T8b949e// Draws a rounded progress bar with the outer dimensions given by width and height. Progress is
T8b949e// a unsigned byte value between 0 and 100
Tffa657void Td2a8ffdrawProgressBarTb4b4b4(Tffa657uint16_t Te6edf3xTb4b4b4, Tffa657uint16_t Te6edf3yTb4b4b4, Tffa657uint16_t Te6edf3widthTb4b4b4, Tffa657uint16_t Te6edf3heightTb4b4b4, Tffa657uint8_t Te6edf3progressTb4b4b4)Tb4b4b4;
T8b949e// Draw a bitmap in the internal image format
Tffa657void Td2a8ffdrawFastImageTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3widthTb4b4b4, Tffa657int16_t Te6edf3heightTb4b4b4, Tff7b72const Tffa657uint8_t Tff7b72*Te6edf3imageTb4b4b4)Tb4b4b4;
T8b949e// Draw a XBM
Tffa657void Td2a8ffdrawXbmTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657int16_t Te6edf3widthTb4b4b4, Tffa657int16_t Te6edf3heightTb4b4b4, Tff7b72const Tffa657uint8_t Tff7b72*Te6edf3xbmTb4b4b4)Tb4b4b4;
T8b949e// Draw icon 16x16 xbm format
Tffa657void Td2a8ffdrawIco16x16Tb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tff7b72const Tffa657uint8_t Tff7b72*Te6edf3icoTb4b4b4, Tffa657bool Te6edf3inverse Tff7b72= Tffa657falseTb4b4b4)Tb4b4b4;
T8b949e/* Text functions */
T8b949e// Draws a string at the given location, returns how many chars have been written
Tffa657uint16_t Td2a8ffdrawStringTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tff7b72const Te6edf3String Tff7b72&Te6edf3textTb4b4b4)Tb4b4b4;
T8b949e// Draws a formatted string (like printf) at the given location
Tffa657void Td2a8ffdrawStringfTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657charTff7b72* Te6edf3bufferTb4b4b4, Te6edf3String Te6edf3formatTb4b4b4, Tb4b4b4.Tb4b4b4.Tb4b4b4. Tb4b4b4)Tb4b4b4;
T8b949e// Draws a String with a maximum width at the given location.
T8b949e// If the given String is wider than the specified width
T8b949e// The text will be wrapped to the next line at a space or dash
T8b949e// returns 0 if everything fits on the screen or the numbers of characters in the
T8b949e// first line if not
Tffa657uint16_t Td2a8ffdrawStringMaxWidthTb4b4b4(Tffa657int16_t Te6edf3xTb4b4b4, Tffa657int16_t Te6edf3yTb4b4b4, Tffa657uint16_t Te6edf3maxLineWidthTb4b4b4, Tff7b72const Te6edf3String Tff7b72&Te6edf3textTb4b4b4)Tb4b4b4;
T8b949e// Returns the width of the const char* with the current
T8b949e// font settings
Tffa657uint16_t Td2a8ffgetStringWidthTb4b4b4(Tff7b72const Tffa657charTff7b72* Te6edf3textTb4b4b4, Tffa657uint16_t Te6edf3lengthTb4b4b4, Tffa657bool Te6edf3utf8 Tff7b72= Tffa657falseTb4b4b4)Tb4b4b4;
T8b949e// Convencience method for the const char version
Tffa657uint16_t Td2a8ffgetStringWidthTb4b4b4(Tff7b72const Te6edf3String Tff7b72&Te6edf3textTb4b4b4)Tb4b4b4;
T8b949e// Specifies relative to which anchor point
T8b949e// the text is rendered. Available constants:
T8b949e// TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER_BOTH
Tffa657void Td2a8ffsetTextAlignmentTb4b4b4(Te6edf3OLEDDISPLAY_TEXT_ALIGNMENT Te6edf3textAlignmentTb4b4b4)Tb4b4b4;
T8b949e// Sets the current font. Available default fonts
T8b949e// ArialMT_Plain_10, ArialMT_Plain_16, ArialMT_Plain_24
Tffa657void Td2a8ffsetFontTb4b4b4(Tff7b72const Tffa657uint8_t Tff7b72*Te6edf3fontDataTb4b4b4)Tb4b4b4;
T8b949e// Set the function that will convert utf-8 to font table index
Tffa657void Td2a8ffsetFontTableLookupFunctionTb4b4b4(Te6edf3FontTableLookupFunction Te6edf3functionTb4b4b4)Tb4b4b4;
T8b949e/* Display functions */
T8b949e// Turn the display on
Tffa657void Td2a8ffdisplayOnTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
T8b949e// Turn the display offs
Tffa657void Td2a8ffdisplayOffTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
T8b949e// Inverted display mode
Tffa657void Td2a8ffinvertDisplayTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
T8b949e// Normal display mode
Tffa657void Td2a8ffnormalDisplayTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
T8b949e// Set display contrast
T8b949e// really low brightness & contrast: contrast = 10, precharge = 5, comdetect = 0
T8b949e// normal brightness & contrast: contrast = 100
Tffa657void Td2a8ffsetContrastTb4b4b4(Tffa657uint8_t Te6edf3contrastTb4b4b4, Tffa657uint8_t Te6edf3precharge Tff7b72= T79c0ff241Tb4b4b4, Tffa657uint8_t Te6edf3comdetect Tff7b72= T79c0ff64Tb4b4b4)Tb4b4b4;
T8b949e// Convenience method to access
Te6edf3virtual Tffa657void Te6edf3setBrightnessTb4b4b4(Tffa657uint8_tTb4b4b4)Tb4b4b4;
T8b949e// Reset display rotation or mirroring
Tffa657void Td2a8ffresetOrientationTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// Turn the display upside down
Tffa657void Td2a8ffflipScreenVerticallyTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// Mirror the display (to be used in a mirror or as a projector)
Tffa657void Td2a8ffmirrorScreenTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// Write the buffer to the display memory
Te6edf3virtual Tffa657void Te6edf3displayTb4b4b4(Tffa657voidTb4b4b4) Tff7b72= T79c0ff0Tb4b4b4;
T8b949e// Clear the local pixel buffer
Tffa657void Td2a8ffclearTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
T8b949e// Log buffer implementation
T8b949e// This will define the lines and characters you can
T8b949e// print to the screen. When you exeed the buffer size (lines * chars)
T8b949e// the output may be truncated due to the size constraint.
Tffa657bool Td2a8ffsetLogBufferTb4b4b4(Tffa657uint16_t Te6edf3linesTb4b4b4, Tffa657uint16_t Te6edf3charsTb4b4b4)Tb4b4b4;
T8b949e// Draw the log buffer at position (x, y)
Tffa657void Td2a8ffdrawLogBufferTb4b4b4(Tffa657uint16_t Te6edf3xTb4b4b4, Tffa657uint16_t Te6edf3yTb4b4b4)Tb4b4b4;
T8b949e// Get screen geometry
Tffa657uint16_t Td2a8ffgetWidthTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
Tffa657uint16_t Td2a8ffgetHeightTb4b4b4(Tffa657voidTb4b4b4)Tb4b4b4;
T8b949e// Implement needed function to be compatible with Print class
Tffa657size_t Td2a8ffwriteTb4b4b4(Tffa657uint8_t Te6edf3cTb4b4b4)Tb4b4b4;
Tffa657size_t Td2a8ffwriteTb4b4b4(Tff7b72const Tffa657charTff7b72* Te6edf3sTb4b4b4)Tb4b4b4;
T8b949e// Implement needed function to be compatible with Stream class
Tff7b72#Tff7b72ifdef __MBED__
Tffa657int Td2a8ff_putcTb4b4b4(Tffa657int Te6edf3cTb4b4b4)Tb4b4b4;
Tffa657int Td2a8ff_getcTb4b4b4(Tb4b4b4) Tb4b4b4{ Tff7b72return T79c0ff-1Tb4b4b4; Tb4b4b4}Tb4b4b4;
Tff7b72#Tff7b72endif
Tffa657uint8_t Tff7b72*Te6edf3bufferTb4b4b4;
Tff7b72#Tff7b72ifdef OLEDDISPLAY_DOUBLE_BUFFER
Tffa657uint8_t Tff7b72*Te6edf3buffer_backTb4b4b4;
Tff7b72#Tff7b72endif
T8b949e// Set the correct height, width and buffer for the geometry
Tffa657void Td2a8ffsetGeometryTb4b4b4(Te6edf3OLEDDISPLAY_GEOMETRY Te6edf3gTb4b4b4, Tffa657uint16_t Te6edf3width Tff7b72= T79c0ff0Tb4b4b4, Tffa657uint16_t Te6edf3height Tff7b72= T79c0ff0Tb4b4b4)Tb4b4b4;
Te6edf3protectedTff7b72:
Te6edf3OLEDDISPLAY_GEOMETRY Te6edf3geometryTb4b4b4;
Tffa657uint16_t Te6edf3displayWidthTb4b4b4;
Tffa657uint16_t Te6edf3displayHeightTb4b4b4;
Tffa657uint16_t Te6edf3displayBufferSizeTb4b4b4;
Te6edf3OLEDDISPLAY_TEXT_ALIGNMENT Te6edf3textAlignmentTb4b4b4;
Te6edf3OLEDDISPLAY_COLOR Te6edf3colorTb4b4b4;
Tff7b72const Tffa657uint8_t Tff7b72*Te6edf3fontDataTb4b4b4;
T8b949e// State values for logBuffer
Tffa657uint16_t Te6edf3logBufferSizeTb4b4b4;
Tffa657uint16_t Te6edf3logBufferFilledTb4b4b4;
Tffa657uint16_t Te6edf3logBufferLineTb4b4b4;
Tffa657uint16_t Te6edf3logBufferMaxLinesTb4b4b4;
Tffa657char Tff7b72*Te6edf3logBufferTb4b4b4;
T8b949e// the header size of the buffer used, e.g. for the SPI command header
Tffa657int Te6edf3BufferOffsetTb4b4b4;
Te6edf3virtual Tffa657int Te6edf3getBufferOffsetTb4b4b4(Tffa657voidTb4b4b4) Tff7b72= T79c0ff0Tb4b4b4;
T8b949e// Send a command to the display (low level function)
Te6edf3virtual Tffa657void Te6edf3sendCommandTb4b4b4(Tffa657uint8_t Te6edf3comTb4b4b4) Tb4b4b4{Tb4b4b4(Tffa657voidTb4b4b4)Te6edf3comTb4b4b4;Tb4b4b4}Tb4b4b4;
T8b949e// Connect to the display
Te6edf3virtual Tffa657bool Te6edf3connectTb4b4b4(Tb4b4b4) Tb4b4b4{ Tff7b72return Tffa657falseTb4b4b4; Tb4b4b4}Tb4b4b4;
T8b949e// Send all the init commands
Te6edf3virtual Tffa657void Te6edf3sendInitCommandsTb4b4b4(Tb4b4b4)Tb4b4b4;
T8b949e// converts utf8 characters to extended ascii
Tffa657charTff7b72* Td2a8ffutf8asciiTb4b4b4(Tff7b72const Te6edf3String Tff7b72&Te6edf3sTb4b4b4)Tb4b4b4;
Tffa657void Tff7b72inline Te6edf3drawInternalTb4b4b4(Tffa657int16_t Te6edf3xMoveTb4b4b4, Tffa657int16_t Te6edf3yMoveTb4b4b4, Tffa657int16_t Te6edf3widthTb4b4b4, Tffa657int16_t Te6edf3heightTb4b4b4, Tff7b72const Tffa657uint8_t Tff7b72*Te6edf3dataTb4b4b4, Tffa657uint16_t Te6edf3offsetTb4b4b4, Tffa657uint16_t Te6edf3bytesInDataTb4b4b4) Te6edf3__attribute__Tb4b4b4(Tb4b4b4(Te6edf3always_inlineTb4b4b4)Tb4b4b4)Tb4b4b4;
Tffa657uint16_t Td2a8ffdrawStringInternalTb4b4b4(Tffa657int16_t Te6edf3xMoveTb4b4b4, Tffa657int16_t Te6edf3yMoveTb4b4b4, Tff7b72const Tffa657charTff7b72* Te6edf3textTb4b4b4, Tffa657uint16_t Te6edf3textLengthTb4b4b4, Tffa657uint16_t Te6edf3textWidthTb4b4b4, Tffa657bool Te6edf3utf8Tb4b4b4)Tb4b4b4;
Te6edf3FontTableLookupFunction Te6edf3fontTableLookupFunctionTb4b4b4;
Tb4b4b4}Tb4b4b4;
Tff7b72#Tff7b72endif
Served by rngit 1.5.2 - Generated in 0.26s